package org.andrewkilpatrick.elmGen.test.simTest;

import org.andrewkilpatrick.elmGen.ElmProgram;

public class chor extends ElmProgram {
	
	public chor() {
		super("chor");
		clear();
		
		allocDelayMem("chordel", 2000);
		allocDelayMem("ap1",	150);	//reverb allpass at reverb input
		allocDelayMem("ap2",	221);	//reverb allpass at reverb input
		allocDelayMem("ap3",	345);	//reverb allpass at reverb input
		allocDelayMem("ap4",	431);	//reverb allpass at reverb input
		allocDelayMem("rap1",	1157);	//reverb ring AP
		allocDelayMem("rap1b",	2257);	//reverb ring AP
		allocDelayMem("rap2",	1978);	//reverb ring AP
		allocDelayMem("rap2b",	1678);	//reverb ring AP
		allocDelayMem("rap3",	1850);	//reverb ring AP
		allocDelayMem("rap3b",	2456);	//reverb ring AP
		allocDelayMem("rap4",	1234);	//reverb ring AP
		allocDelayMem("rap4b",	1567);	//reverb ring AP
		allocDelayMem("d1",	2180	);	//reverb ring delay
		allocDelayMem("d2",	3956	);	//reverb ring delay
		allocDelayMem("d3",	4165	);	//reverb ring delay
		allocDelayMem("d4",	3456	);	//reverb ring delay
		
		
		int	sigin = REG0;	//sum of inputs, mono	
		int	chorout = REG1; //output of chorus process, input to reverb allpass filters
		int	revin = REG2; 	//input to reverb ring
		int	width =	REG3;	//chorus width from pot2
		int	width2 = REG4;	//smoothed value of total chorus width
		int	effmix = REG5;	//value for mixing chorus from pot2	
		int	temp = REG6;	//temp value for calculations
		int	rfil = REG7;	//reverb ring filter register
		double rt = 0.5;	//reverb time

//skp		RUN,	LOOP
//??		
//wlds		0,	12,	160		
		loadSinLFO(0, 12, 160);
//wlds		1,	12,	1500		
		loadSinLFO(1, 12, 1500);
//LOOP:                                      
//??		

	
//rdax 	pot2,	1.9999		;read pot2 times approx. 2.0
		readRegister(POT2, 1.9999);		
//sof	1.9999,	0		;pot2 * approx. 4, saturation limits to approx. 1
		scaleOffset(1.9999, 0);
//sof	0.002,	0		;scale limited value to 0.002 max as input to smoothing filter
		scaleOffset(0.002, 0);
//rdax	effmix,	0.998		;effmix becomes smoothing register, feedback=(1-input drive)
//wrax	effmix,	0		;effmix ranges 0 to 0.9999 during the first 1/4 turn of pot2
//rdax	pot2,	0.05		;set maximum width value (sweeps most of delay maximum)
//sof	0.002,	0		;scale value as input to smoothing filter 
//rdax	width,	0.998		;read smoothing filter times (1-input drive)
//wrax	width,	0		;store temporary width value (from pot 2), clear accumulator
		
		
		readDelay("d1", 1.0, 1);
		readRegister(chorout, 0.5);
		
		writeRegister(DACR, 1.0);
		writeRegister(DACL, 0.0);
		
	}

}
